<template>
  <div>
    <el-table stripe :data="tableData" style="width: 100%">
      <el-table-column prop="date" label="日期" width="180"> </el-table-column>
      <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
      <el-table-column prop="progress" label="当前进度"> </el-table-column>
      <el-table-column label="进度登记">
        <el-button type="info" @click="handleAdd"
          >登记</el-button
        ></el-table-column
      >
    </el-table>

    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
    >
      <!-- 用户的表单信息 -->
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="进度登记" prop="birth">
          <el-select v-model="value" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <!-- <span>这是一段信息</span> -->
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
// import axios from "axios";
export default {
  name: "MyRegister",
  data() {
    return {
      options: [
        {
          value: "审核中",
          label: "审核中",
        },
      ],
      value: "",
      dialogVisible: false,
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          progress: "",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
      form: {
        birth: "", //日期
      },
    };
  },
  mounted() {
    // axios
    //   .post("/api/data", {
    //     // 发送POST请求，第二个参数为请求数据
    //     name: "John",
    //     age: 25,
    //   })
    //   .then((response) => {
    //     console.log(response.data);
    //   })
    //   .catch((error) => {
    //     console.log(error);
    //   });
  },
  methods: {
    open() {
      this.$prompt("请输入回访时间", "请安排时间", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      });
    },
    handleAdd() {
      this.modalType = 0;
      this.dialogVisible = true;
    },
    // 弹窗关闭的时候触发
    handleClose() {
      console.log(this.form);
      this.$refs.form.resetFields();
      this.dialogVisible = false;
    },
    cancel() {
      this.handleClose();
    },
    // 确认关闭时
    submit() {
      console.log(this.tableData[0].progress);
      this.tableData[0].progress = this.value;
      console.log(this.value);
      console.log(this.form.birth ? this.form.birth : "9999");
      this.dialogVisible = false;
    },
  },
};
</script>

<style>
</style>